﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class NapTien : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int userid = -1;
        try
        {
            userid = Convert.ToInt32(Session["userid"]);
        }
        catch (Exception)
        {
            userid = -1;
            Session["userid"] = -1;
        }
        if (userid <= 0)
        {
            Response.Redirect("~/login.aspx");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Bank.Balance _balanceService = new Bank.Balance();
        int userid = Convert.ToInt32(Session["userid"]);
        string pass = TextBox2.Text;
        int sotien = Convert.ToInt32(TextBox1.Text);
        int balance = _balanceService.naptien(sotien, userid, pass);
        if (balance > 0)
        {
            Label1.Text = balance.ToString();
            MultiView1.ActiveViewIndex = 1;
        }
    }
}
